import pygal
from c_15.die import Die
#	创建两个D6
die_1=Die()
die_2=Die()

#	掷几次骰子，并将结果存储在一个列表中,数字可以更改。
results=[die_1.roll()*die_2.roll() for roll_num in range(100)]
#	分析结果
max_result=die_1.num_sides*die_2.num_sides
frequencies=[results.count(v) for v in range(2,max_result+1)]
#	对结果进行可视化
hist=pygal.Bar()
hist.title="Results of rolling two D6 dice 100 times."
hist.x_labels=[str(labels) for labels in range(2,max_result+1)]
hist.x_title="Result"
hist.y_title="Frequency of Result"
hist.add('D6*D6',frequencies)
hist.render_to_file('15-9.svg')
